package com.lagou.rpc.consumer.controller;


import com.lagou.rpc.api.IUserService;
import com.lagou.rpc.consumer.proxy.RpcClientProxy;
import com.lagou.rpc.pojo.User;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class UserController {

    @RequestMapping(value = "/getUserById/{userId}", method = RequestMethod.GET)
    public User getUserById(@PathVariable("userId") int userId) {
        IUserService userService = (IUserService) RpcClientProxy.createProxy(IUserService.class);
        return userService.getById(userId);
    }

}
